#include "StateLabel.h"
#include <QMouseEvent>

StateLabel::StateLabel(QWidget *parent)
    : QLabel(parent)
    , StateBase()
{
    _actived = false;
    _selected = false;
}

void StateLabel::mouseDoubleClickEvent(QMouseEvent *event){
    if(Qt::LeftButton == event->button()){
        emit sigDblClicked();
    }
    QLabel::mouseDoubleClickEvent(event);
}
void StateLabel::mousePressEvent(QMouseEvent *event){
    if(Qt::LeftButton == event->button()){
        _pressed = true;
    }
    QLabel::mousePressEvent(event);
}
void StateLabel::mouseReleaseEvent(QMouseEvent *event){
    if(Qt::LeftButton == event->button() && _pressed){
        _pressed = false;
        emit sigClicked();
    }
    QLabel::mouseReleaseEvent(event);
}
void StateLabel::leaveEvent(QEvent *event){
    _pressed = false;
}
void StateLabel::repolish(){
    style()->unpolish(this);
    style()->polish(this);
}
